var t = require("../../../@babel/runtime/helpers/defineProperty"), a = getApp();

Page({
    data: {
        language: "",
        selected: 0,
        wait: [],
        waitLoadMore: !1,
        waitPage: 1,
        waitLastPage: 0,
        comment: [],
        commentLoadMore: !1,
        commentPage: 1,
        commentLastPage: 0,
        other: []
    },
    onLoad: function(t) {},
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {
        this._initData(), this._getNetData(this.data.selected);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {},
    _getNetData: function(t) {
        var e = this, o = a.getNetAddresss("order.my-comment.paging");
        1 == a.globalData.store_alone_temp && (o = a.getNetAddresss("plugin.store-alone-temp.frontend.member.my-comment")), 
        o += "&page=" + ("0" == t ? this.data.waitPage : this.data.commentPage), o += "&status=" + t, 
        a._getNetWork({
            url: o,
            success: function(a) {
                var o = a.data;
                1 == o.result && (0 == t ? e.setData({
                    wait: o.data.list.data.length > 0 ? o.data.list.data : [],
                    waitLoadMore: !0,
                    waitLastPage: o.data.list.last_page ? o.data.list.last_page : 0
                }) : 1 == t && e.setData({
                    comment: o.data.list.data.length > 0 ? o.data.list.data : [],
                    commentLoadMore: !0,
                    commentLastPage: o.data.list.last_page ? o.data.list.last_page : 0
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var e, o = this, n = a.getNetAddresss("order.my-comment.paging"), i = this.data.selected, s = "0" == i ? "wait" : "comment";
        if (this.data["".concat(s, "Page")] >= this.data["".concat(s, "LastPage")]) return !1;
        this.setData((t(e = {}, "".concat(s, "LoadMore"), !1), t(e, "".concat(s, "Page"), this.data["".concat(s, "Page")] + 1), 
        e)), n += "&page=" + this.data["".concat(s, "Page")], n += "&status=" + i, a._getNetWork({
            url: n,
            success: function(a) {
                var e, n = a.data;
                if (o.setData(t({}, "".concat(s, "LoadMore"), !0)), 1 == n.result) {
                    var i = o.data[s];
                    o.setData(t({}, "".concat(s), i.concat(n.data.list.data)));
                } else o.setData((t(e = {}, "".concat(s, "Page"), o.data["".concat(s, "Page")] - 1), 
                t(e, "".concat(s, "LoadMore"), !1), e));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    toComment: function(t) {
        var a = t.target.dataset.itemid, e = t.target.dataset.good;
        wx.navigateTo({
            url: "/packageD/member/evaluate/evaluate?order_id=" + a + "&id=" + e.id
        });
    },
    opration: function(t) {
        var a = t.target.dataset.btn, e = t.target.dataset.good;
        if (a && 1 == a.value) wx.navigateTo({
            url: "/packageD/member/addevaluate/addevaluate?order_id=" + e.order.id + "&item=" + JSON.stringify(e)
        }); else {
            var o = "order_id=".concat(e.has_one_comment.order_id, "&goods_id=").concat(e.has_one_comment.goods_id, "&comment_id=").concat(e.has_one_comment.id, "&order_goods_id=").concat(e.id);
            wx.navigateTo({
                url: "/packageD/member/CommentDetails/CommentDetails?" + o
            });
        }
    },
    _initData: function() {
        this.setData({
            selected: 0,
            wait: [],
            waitLoadMore: !1,
            waitPage: 1,
            waitLastPage: 0,
            comment: [],
            commentLoadMore: !1,
            commentPage: 1,
            commentLastPage: 0,
            other: []
        });
    },
    swichTabTItem: function(t) {
        var a = t.detail.index;
        this.setData({
            selected: a
        }), 0 == this.data.selected ? this.setData({
            wait: [],
            waitLoadMore: !1,
            waitLastPage: 0,
            waitPage: 1
        }) : this.setData({
            comment: [],
            commentLoadMore: !1,
            commentPage: 1,
            commentLastPage: 0
        }), this._getNetData(this.data.selected);
    }
});